<html>
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Demo - DPL SplitButton</title>
    <link
            href="../../../../g.tbcdn.cn/kissy/k/1.3.1/css/dpl/--base.css,badges.css,forms.css,icons.css,labels.css,tables.css-20130815" tppabs="http://g.tbcdn.cn/kissy/k/1.3.1/css/dpl/??base.css,badges.css,forms.css,icons.css,labels.css,tables.css?20130815"
            rel="stylesheet"/>
    <link
            href="../../../../g.tbcdn.cn/kissy/k/1.3.1/fi000001.css" tppabs="http://g.tbcdn.cn/kissy/k/1.3.1/??button/assets/dpl.css,calendar/assets/dpl.css,menu/assets/dpl.css,combobox/assets/dpl.css,menubutton/assets/dpl.css,overlay/assets/dpl.css,split-button/assets/dpl.css,tabs/assets/dpl.css,toolbar/assets/dpl.css,tree/assets/dpl.css?20130815"
            rel="stylesheet"/>

    <link href="../assets/docs.css-20130815" tppabs="http://docs.kissyui.com/1.3/dpl/assets/docs.css?20130815" rel="stylesheet"/>
<link rel="stylesheet" href="../assets/prettify.css-20130815" tppabs="http://docs.kissyui.com/1.3/dpl/assets/prettify.css?20130815">
<script type="text/javascript" src="../assets/prettify.js" tppabs="http://docs.kissyui.com/1.3/dpl/assets/prettify.js"></script>
<style>
    .para {
        margin: 1em 0;
    }
</style>
</head>
<body onload="prettyPrint()">

<div class="container">

<div class="page-header">
    <h1>下拉按钮
        <small>构建支持下拉菜单的按钮组</small>
    </h1>
</div>
<div id="split">
    <h2>分离式下拉按钮</h2>
    <div class="row-fluid">
        <div class="span8">
            <h3>概述和示例</h3>
            <p>在分组按钮的样式和标签基础上我们可以很容易的创建分离式下拉按钮。分离式下拉按钮左边部分有标准的按钮功能，右边部分有一个下拉菜单。</p>
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-split-button-left">Action</div>
                    <div class="ks-menu-button ks-button ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>
                </div>
                <!-- /ks-split-button -->
                <div class="ks-split-button">
                    <div class="ks-button ks-button-primary ks-split-button-left">Action</div>
                    <div class="ks-menu-button ks-button ks-button-primary ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>

                </div>
                <!-- /ks-split-button -->
                <div class="ks-split-button">
                    <div class="ks-button ks-button-danger ks-split-button-left">Danger</div>
                    <div class="ks-menu-button ks-button ks-button-danger ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>

                </div>
                <!-- /ks-split-button -->
            </div>
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-button-warning ks-split-button-left">Warning</div>
                    <div class="ks-menu-button ks-button ks-button-warning ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>

                </div>
                <!-- /ks-split-button -->
                <div class="ks-split-button">
                    <div class="ks-button ks-button-success ks-split-button-left">Success</div>
                    <div class="ks-menu-button ks-button ks-button-success ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>

                </div>
                <!-- /ks-split-button -->
                <div class="ks-split-button">
                    <div class="ks-button ks-button-info ks-split-button-left">Info</div>
                    <div class="ks-menu-button ks-button ks-button-info ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>
                </div>
                <!-- /ks-split-button -->
            </div>
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-button-inverse ks-split-button-left">Inverse</div>
                    <div class="ks-menu-button ks-button ks-button-inverse ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>
                </div>
                <!-- /ks-split-button -->
            </div>
            <!-- /ks-button-toolbar -->
        </div>
        <div class="span16">
            <h3>标签示例</h3>
            <p>我们利用第二个按钮动作扩展了下拉按钮，点击右边图标时触发。</p>

<pre class="prettyprint linenums">
&lt;div class="ks-split-button"&gt;
  &lt;div class="ks-button ks-button-mini"&gt;Mini action&lt;/div&gt;
  &lt;div class="ks-menu-button ks-button-mini"&gt;
        &lt;div class="ks-menu-button-caption"&gt;&lt;/div&gt;
        &lt;div class="ks-popupmenu"&gt;
          &lt;div class="ks-menuitem"&gt;Action&lt;/div&gt;
          &lt;div class="ks-menuitem"&gt;Another action&lt;/div&gt;
          &lt;div class="ks-menuitem"&gt;Something else here&lt;/div&gt;
        &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>

        </div>
    </div>
    <div class="row-fluid">
        <div class="span24">
            <h3>尺寸</h3>
            <p>可以设置额外的按钮样式<code>.ks-button-mini</code>, <code>.ks-button-small</code>, 或者 <code>。ks-button-large</code> 来定义按钮的大小</p>
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-button-large ks-split-button-left">Large action</div>
                    <div class="ks-menu-button ks-button ks-button-large ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>

                </div>
                <!-- /ks-split-button -->
            </div>
            <!-- /ks-button-toolbar -->
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-button-small ks-split-button-left">Small action</div>
                    <div class="ks-menu-button ks-button ks-button-small ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>
                </div>
                <!-- /ks-split-button -->
            </div>
            <!-- /ks-button-toolbar -->
            <div class="para">
                <div class="ks-split-button">
                    <div class="ks-button ks-button-mini ks-split-button-left">Mini action</div>
                    <div class="ks-menu-button ks-button ks-button-mini ks-split-button-right">
                        <div class="ks-menu-button-caption"></div>
                        <div class="ks-popupmenu">
                            <div class="ks-menuitem">Action</div>
                            <div class="ks-menuitem">Another</div>
                            <div class="ks-menuitem">else</div>
                        </div>
                    </div>
                </div>
                <!-- /ks-split-button -->
            </div>
            <!-- /ks-button-toolbar -->
        </div>
    </div>
</div>

<div id="split2">
    <h2>下拉菜单位置</h2>
    <div class="row-fluid">
        <div class="span8">
            <h3>概述和示例</h3>
            <p>可以通过 menu 配置控制下拉菜单的位置</p>
            <div class="para" id="para2">
            </div>
        </div>

        <div class="span16">
            <h3>实例</h3>
            <p>通过 menu 配置控制下拉菜单的位置</p>
            <pre class="prettyprint linenums">
new SplitButton({
    render:"#para2",
    button:{
        xclass:'button',
        content:'action'
    },
    alignWithEl:false,
    menuButton:{
        xclass:'menu-button',
        matchElWidth:false,
        menu:{
            children:[
                {
                    content:'some action'
                },
                {
                    content:'more action'
                }
            ]
        }
    }
}).render();
            </pre>
        </div>
    </div>
</div>

<div></div>

</div>
<script src="../../../../g.tbcdn.cn/kissy/k/1.3.1/seed.js" tppabs="http://g.tbcdn.cn/kissy/k/1.3.1/seed.js" data-config="{combine:true}"></script>
<script>
    KISSY.use('split-button', function (S, SplitButton) {
        var $ = S.all;
        $(".ks-split-button").each(function (n) {
            new SplitButton({
                srcNode:n
            }).render();
        });

        new SplitButton({
            render:"#para2",
            button:{
                xclass:'button',
                content:'action'
            },
            alignWithEl:false,
            menuButton:{
                xclass:'menu-button',
                matchElWidth:false,
                menu:{
                    children:[
                        {
                            content:'some action'
                        },
                        {
                            content:'more action'
                        }
                    ]
                }
            }
        }).render();
    });
</script>
</body>
</html>